﻿@{
    Layout = "";
}
@model Nop.Plugin.Widgets.GoogleAdwords.Models.ConfigurationModel
@using Nop.Web.Framework;
@Html.Action("StoreScopeConfiguration", "Setting", new { area = "Admin" })
@{
    //default values
    var googleAdwords_conversionScript = Html.Raw(HttpUtility.JavaScriptStringEncode(Nop.Plugin.Widgets.GoogleAdwords.GoogleAdwordsPlugin.DEFAULT_CONVERSION_SCRIPT));

    var googleAdwords_remarketingScript = Html.Raw(HttpUtility.JavaScriptStringEncode(Nop.Plugin.Widgets.GoogleAdwords.GoogleAdwordsPlugin.DEFAULT_REMARKETING_SCRIPT));



}
<script type="text/javascript">
    $(document).ready(function () {

        $("#pre-configure-google-adwords").click(preConfigureGoogleAdwords);
    });

    function preConfigureGoogleAdwords() {
        $('#@Html.FieldIdFor(model => model.ConversionScript)').val('@googleAdwords_conversionScript');
        $('#@Html.FieldIdFor(model => model.RemarketingScript)').val('@googleAdwords_remarketingScript');
    }

  

</script>
@using (Html.BeginForm())
{
    <table class="adminContent">
        <tr>
            <td class="adminTitle" colspan="2">
				@T("Plugins.Widgets.GoogleAdwords.Configure.Description")
            </td>
        </tr>
        <tr id="pnlConversionId">
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.ConversionId_OverrideForStore, model => model.ConversionId, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.ConversionId):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.ConversionId)
                @Html.ValidationMessageFor(model => model.ConversionId)
            </td>
        </tr>
        <tr id="pnlConversionLabel">
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.ConversionLabel_OverrideForStore, model => model.ConversionLabel, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.ConversionLabel):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.ConversionLabel)
                @Html.ValidationMessageFor(model => model.ConversionLabel)
            </td>
        </tr>
        <tr>
            <td class="adminTitle" colspan="2" align="center">
                <span style="font-weight:bold;padding:20px">
                    Tokens : {GOOGLECONVERSIONID}, {GOOGLECONVERSIONLABEL}, {PAGETYPE}, {CATEGORYNAME}, {PRODID}, {VALUE}
                </span>
            </td>
        </tr>        <tr id="pnlConversionScript">
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.ConversionScript_OverrideForStore, model => model.ConversionScript, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.ConversionScript):<br />
                @Html.HiddenFor(model => model.DefaultConversionScript)
                <input type="button" id="pre-configure-google-adwords" class="k-button" value="@T("Plugins.Widgets.GoogleAdwords.LoadDefaultScript")" />
                   
            </td>
            <td class="adminData">
                @Html.TextAreaFor(model => model.ConversionScript, new { style = "Width: 600px; Height: 200px;" })
                @Html.ValidationMessageFor(model => model.ConversionScript)
            </td>
        </tr>

        <tr id="pnlRemarketingScript">
            <td class="adminTitle">
                @Html.OverrideStoreCheckboxFor(model => model.RemarketingScript_OverrideForStore, model => model.RemarketingScript, Model.ActiveStoreScopeConfiguration)
                @Html.NopLabelFor(model => model.RemarketingScript):
            </td>
            <td class="adminData">
                @Html.TextAreaFor(model => model.RemarketingScript, new { style = "Width: 600px; Height: 200px;" })
                @Html.ValidationMessageFor(model => model.RemarketingScript)
            </td>
        </tr> 
        <tr>
            <td colspan="2" width="100%">
                <input type="submit" name="save" class="t-button" value="@T("Admin.Common.Save")" />
            </td>
        </tr>
    </table>
}
